const AccessToken = 'SAASDAFS'

export const setJwtToken = (token)=>{
    sessionStorage.setItem(AccessToken,token);
}
export const  getJwtToken = ()=>{
    let token = sessionStorage.getItem(AccessToken)
    if(token!=null){
        return token
    }else {
        return ''
    }
}
export const getTokenUser = () => {
    let token = getJwtToken()
    if (token!==''){
         let userString = decodeURIComponent(
            window.atob(token.split('.')[1])
        )
        return JSON.parse(userString).sub
    }
    return '-1'
}
